package com.xgggh.view;

import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.app.AlertDialog;
import android.view.Gravity;
import android.view.Window;
import android.view.WindowManager;

import com.xgggh.redpack.R;

/**
 * Created by az on 2018/5/28.
 */

public class LoadingDialog extends AlertDialog {


    public LoadingDialog(@NonNull Context context) {
        this(context, R.style.AppTheme);
    }

    protected LoadingDialog(@NonNull Context context, int themeResId) {
        super(context, themeResId);
        setContentView(R.layout.activity_camera);

        Window window = getWindow();
        WindowManager.LayoutParams params = window.getAttributes();
        params.gravity = Gravity.CENTER;
        window.setAttributes(params);
    }

    protected LoadingDialog(@NonNull Context context, boolean cancelable, @Nullable OnCancelListener cancelListener) {
        super(context, cancelable, cancelListener);
    }

    @Override
    public void onBackPressed() {
        super.onBackPressed();
        show();
        cancel();
        dismiss();
    }

    @Override
    public boolean isShowing() {
        return super.isShowing();
    }


}
